package com.golookon.entity;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name = "menu")
public class Menu extends BaseEntity{

	 @Column(name = "name")
	private String name; 
	 @Column(name = "contact")
		private String contact; 
	 
	 
	 @OneToMany(mappedBy = "menu", 
	            targetEntity=MenuItem.class,
	            fetch=FetchType.EAGER,
	            cascade=CascadeType.ALL)
	private List<MenuItem> menuItems;
    
	public List<MenuItem> getMenuItems() { 
		return menuItems;
	}

	public void setMenuItems(List<MenuItem> menuItems) {
		this.menuItems = menuItems;
	}


	public Menu() {
		// TODO Auto-generated constructor stub
	}

	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}




	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public void addMenuItem(MenuItem mi){
		menuItems.add(mi);
	}
	
	public void deleteMenuItem(MenuItem mi){
		if(menuItems.contains(mi)){
			menuItems.remove(mi);
		}
	}

}
